import dayjs from "dayjs"
import { ECOption } from "@/components/ECharts/config"
import HomeWater from "@/assets/images/home-water.png"
import HomeElectricity from "@/assets/images/home-electricity.png"
import HomeGas from "@/assets/images/home-gas.png"
interface DateValueType {
  [key: string]: { timeType: string; dataTime: string }
}
// 日期区间
export const dateOption = [
  { label: "日", value: "day" },
  { label: "月", value: "month" },
  { label: "年", value: "year" }
]
export const dateValue: DateValueType = {
  day: { timeType: "3", dataTime: dayjs().format("YYYYMMDD") },
  month: { timeType: "2", dataTime: dayjs().format("YYYYMM") },
  year: { timeType: "1", dataTime: dayjs().format("YYYY") }
}
// 能源统计
export const energyStatItem = [
  { title: "水", key: "water", value: 0, unit: "", cover: HomeWater },
  { title: "电", key: "electric", value: 0, unit: "", cover: HomeElectricity },
  { title: "天然气", key: "gas", value: 0, unit: "", cover: HomeGas }
]
// 电能趋势
export const electricChart: ECOption = {
  grid: { top: "15%", right: "5%", bottom: "10%", left: "10%" },
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow"
    }
  },
  xAxis: {
    type: "category",
    data: []
  },
  yAxis: { type: "value", name: "kWh" },
  series: [
    {
      data: [],
      type: "bar",
      barWidth: 30
    }
  ]
}
// 水燃趋势
export const waterGasChart: ECOption = {
  grid: { top: "15%", right: "5%", bottom: "10%", left: "10%" },
  tooltip: {
    trigger: "axis",
    axisPointer: { type: "cross" }
  },
  xAxis: {
    type: "category",
    data: []
  },
  yAxis: [{ type: "value", name: "m³" }],
  series: [
    {
      name: "用气量",
      data: [],
      type: "line"
    },
    {
      name: "用水量",
      data: [],
      type: "line"
    }
  ]
}
// 厂区电能排名
export const lineElectricChart: ECOption = {
  title: { subtext: "kWh" },
  grid: { top: "15%", right: "10%", bottom: "10%", left: "10%" },
  tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
  xAxis: { type: "value" },
  yAxis: { type: "category", inverse: true, data: [] },
  series: [
    {
      realtimeSort: true,
      type: "bar",
      data: [],
      label: {
        show: true,
        position: "right",
        valueAnimation: true
      },
      showBackground: true,
      backgroundStyle: {
        color: "rgba(180, 180, 180, 0.2)"
      },
      barWidth: 15
    }
  ]
}
export const bandItem = [
  { label: "峰", value: 0, key: "peakValue", unit: "" },
  { label: "平", value: 0, key: "flatValue", unit: "" },
  { label: "谷", value: 0, key: "valleyValue", unit: "" }
]
export const bandStatChart: ECOption = {
  grid: { top: "15%", right: "5%", bottom: "10%", left: "10%" },
  tooltip: { trigger: "item" },
  legend: {
    orient: "vertical",
    right: "5%",
    top: "center",
    icon: "circle"
  },
  series: [
    {
      name: "峰平谷占比图",
      type: "pie",
      radius: "50%",
      center: ["35%", "50%"],
      data: [],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: "rgba(0, 0, 0, 0.5)"
        }
      }
    }
  ]
}
